From Clint Huffman:

The function is CalculateHourlyTrend and it is in the PalGenerateMultiCounterStats.ps1 since it does the bulk of the statistics. The actual code is below, but effectively I get the average value from each time slice (a time slice is one of many equal parts of time in the log that is used to generate an average, min, max, and hourly trend value) and compare it to all of the previous time slice averages to produce an increasing or decreasing trend and then I covert it to hourly. For example, I compare the first average time slice value to the second time slice value and the difference is the value for the second time slice. The third time slice is compared to the first and second, and so on. It certainly isnt scientific, but for practical reasons it just works.


Function CalculateHourlyTrend
{
       param($Value,$AnalysisIntervalInSeconds,$DataTypeAsString)
       
    If ($AnalysisIntervalInSeconds -lt 3600)
       {
        $IntervalAdjustment = 3600 / $AnalysisIntervalInSeconds 
        Return ConvertToDataType -ValueAsDouble $($Value * $IntervalAdjustment) -DataTypeAsString $DataTypeAsString
    }

    If ($AnalysisIntervalInSeconds -gt 3600)
       {
        $IntervalAdjustment = $AnalysisIntervalInSeconds / 3600
        Return ConvertToDataType -ValueAsDouble $($Value / $IntervalAdjustment) -DataTypeAsString $DataTypeAsString
    }

    If ($AnalysisIntervalInSeconds -eq 3600)
       {
        Return ConvertToDataType -ValueAsDouble $Value -DataTypeAsString $DataTypeAsString
       }
} 
